package com.ruoyi.yljf.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.AnswerCardsMapper;
import com.ruoyi.yljf.domain.AnswerCards;
import com.ruoyi.yljf.service.IAnswerCardsService;

import javax.annotation.Resource;

/**
 * 答题卡Service业务层处理
 * 
 * @author metaee
 * @date 2025-03-22
 */
@Service
public class AnswerCardsServiceImpl extends ServiceImpl<AnswerCardsMapper, AnswerCards> implements IAnswerCardsService {
    @Resource
    private AnswerCardsMapper answerCardsMapper;
    
    /**
     * 查询答题卡列表
     * 
     * @param answerCards 答题卡
     * @return 答题卡
     */
    @Override
    public List<AnswerCards> selectAnswerCardsList(AnswerCards answerCards) {
    	LambdaQueryWrapper<AnswerCards> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(answerCards.getUserId())) {
			queryWrapper.eq(AnswerCards::getUserId, answerCards.getUserId());
		}
        if (StringUtils.isNotNull(answerCards.getQuestionId())) {
			queryWrapper.eq(AnswerCards::getQuestionId, answerCards.getQuestionId());
		}
        if (StringUtils.isNotNull(answerCards.getNum())) {
			queryWrapper.eq(AnswerCards::getNum, answerCards.getNum());
		}
        if (StringUtils.isNotEmpty(answerCards.getSelectedAnswer())) {
			queryWrapper.eq(AnswerCards::getSelectedAnswer, answerCards.getSelectedAnswer());
		}
        if (StringUtils.isNotEmpty(answerCards.getIsCorrect())) {
			queryWrapper.eq(AnswerCards::getIsCorrect, answerCards.getIsCorrect());
		}
        if (StringUtils.isNotEmpty(answerCards.getStatus())) {
			queryWrapper.eq(AnswerCards::getStatus, answerCards.getStatus());
		}
        return answerCardsMapper.selectList(queryWrapper);
    }
}
